<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('由订单直接出库')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-ncOuputCf-edit" th:object="${ncOuputCf}">
        <input id="outputId" name="outputId" th:field="*{outputId}" type="hidden">
        <input id="cforderId" name="cforderId" th:field="*{cforderId}" type="hidden">
        <input id="planId" name="planId" th:field="*{planId}" type="hidden">
        <input id="checkId" name="checkId" th:field="*{checkId}" type="hidden">
        <!--<input id="inputId" name="inputId" th:field="*{inputId}" type="hidden">-->

            <div class="form-group">
                <label class="col-sm-3 control-label">库存：</label>
                <div class="col-sm-8">
                    <select id="inputId" name="inputId" class="form-control select2-multiple" required>
                        <option th:each="stock:${stocks}" th:value="${stock.inputId}" th:text="${stock.piciCode} +'-'+ ${stock.cropNameCn}+'-'+${stock.cropVarietiesCn}+'-('+${stock.leftAmount}+')kg'"
                                ></option>
                    </select>
                </div>
            </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">出库类型：</label>
            <div class="col-sm-8">
                <select name="outputType" class="form-control m-b" th:with="type=${@dict.getType('cforderType')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:field="*{outputType}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">实际提供数量（kg）：</label>
            <div class="col-sm-8">
                <input id="realAmout" name="realAmout" required th:field="*{realAmout}" class="form-control" type="number">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">框数：</label>
            <div class="col-sm-8">
                <input id="boxAmount" name="boxAmount"  th:field="*{boxAmount}" class="form-control" type="number" onkeyup=" value=value.replace(/^(0+)|[^\d]+/g,'')">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">出库时间：</label>
            <div class="col-sm-8">
                <input id="outputTime" data-format="yyyy-MM-dd HH:mm:ss" data-type="datetime" required name="outputTime"
                       th:value="*{#dates.format(outputTime, 'yyyy-MM-dd hh:mm:ss')}" class="form-control" type="text"
                       th:class="time-input">

            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea id="remark" rows="4" name="remark" th:field="*{remark}" class="form-control"
                          type="text"></textarea>
            </div>
        </div>

    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "system/ncOuputCf";
    $("#form-ncOuputCf-edit").validate({
        rules: {
            xxxx: {
                required: true,
            },
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/saveOutput", $('#form-ncOuputCf-edit').serialize(),function () {
                try{
                parent.reload();
                }catch (e) {
                    
                }
            });
        }
    }

    /*$(function () {
        /!*获取库存中匹配的条目*!/
        var url = ctx + "system/ncInputCf/inStocks"
        var cropVarieties = [[${cropVarieties}]];
        myPost(url, {cropVarieties: cropVarieties},
            function (data) {

                if (data.code == 0) {
                } else {
                    layer.msg(data.msg);
                }
            }, function (e) {
                console.log("确认失败!");
            })

    });*/
</script>
</body>
</html>
